<html>

<head>

<title>js—apply 专项练习</title>
<meta charset="utf-8">
<style>
.practice-content {
    position: relative;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1;
    width: 100%;
	height:100%;
    overflow-x: hidden;
}

.practice-title{
	text-align:center;
	background: #FFECF5;
	box-shadow: #FFF7FB;
	height:40px;
	font-size: 20px;
	font-weight:bold;
	padding-top:10px;
}

.practice-information {
	margin-top:20px;
	text-align:center;
	background: #FFECF5;
	box-shadow: #FFF7FB;
	height:40px;
	font-size: 20px;
	font-weight:bold;
	padding-top:10px;
}

.information {
	margin-top:20px;
	text-align:center;
	background: #FFECF5;
	box-shadow: #FFF7FB;
	height:200px;
	font-size: 20px;
	font-weight:bold;
	padding-top:10px;
}

.operate {
	margin-top:20px;
	text-align:center;
	background: #00FFFF;
	box-shadow: #FFF7FB;
	height:150px;
	font-size: 20px;
	font-weight:bold;
	padding-top:10px;
}

.operate .selectContent {
	width: 100px;
	height:20px;
}

.operate .model {
	margin: 5px 0px;
}
</style>

</head>

 <body>

<div class="practice-content">
	<div class="practice-title">
		js—apply 专项练习
	</div>
	
	<div class="practice-information">
		相关参考资料
	</div>
	
	<div class="information">
		<p>
			<a target="_blank" href='https://www.cnblogs.com/chenhuichao/p/8493095.html'>https://www.cnblogs.com/chenhuichao/p/8493095.html</a>
		</p>
		<p>
			<a target="_blank" href='https://www.cnblogs.com/ClareZjy/p/6365891.html'>https://www.cnblogs.com/ClareZjy/p/6365891.html</a>
		</p>
		<p>
			<a target="_blank" href='https://www.toutiao.com/a6503707428540908045'>https://www.toutiao.com/a6503707428540908045</a>
		</p>
	</div>
	
</div>

<script>
var N = {
	say: function(params) {
		console.log(this);
		console.log('params', params);
		alert('say function!');
	},
	speak: function(params1, params2) {
		console.log(this);
		console.log('params1'+params+'，params2'+params2);
		alert('speak function!');
	}
}

var func_str = 'N.say';

console.log('=========== 使用call ===========');
eval('('+func_str+')').call(this, '123');

console.log('=========== 使用apply ===========');
eval('('+func_str+')').apply(this, ['123']);


/*定义一个人类*/  
function Person(name,age) {  
	this.name=name;  
	this.age=age;
	this.say = function () {
		alert('我会说话');
	}
}

/*定义一个学生类*/  
function Student(name,age,grade) {  
	//Person.apply(this,arguments);  
	Person.call(this, name, age);  
	this.grade=grade;  
}

//创建一个学生类  
var student = new Student("zhangsan", 21, "一年级");

//测试  
alert("name："+student.name+"\n"+"age："+student.age+"\n"+"grade："+student.grade);

student.say();

console.log(student);
console.log(student.prototype);
console.log(student.__proto__);

</script>

  </body>

</html>